* fns.c (concat): Catch string overflow earlier.
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 18 Jun 2011 15:08:31 +0000 (08:08 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 18 Jun 2011 15:08:31 +0000 (08:08 -0700)
Do not rely on integer wraparound.

src/ChangeLog
src/fns.c

index 5493a0fc2207312b4124b2cf5169020a9ee6c680..e01e7ed7eceb68849e987c6ced16031ada59ac34 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-18  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * fns.c (concat): Catch string overflow earlier.
+       Do not rely on integer wraparound.
+
        * dispextern.h (struct it.overlay_strings_charpos): EMACS_INT, not int.
 
 2011-06-17  Paul Eggert  <eggert@cs.ucla.edu>
index a19c886e3e1f0ef002db37d7337e6c8c748fcf68..4c1505ab0f12b94cad973b80778d8a56c88fa8bc 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -565,8 +565,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
        }
 
       result_len += len;
-      if (result_len < 0)
-       error ("String overflow");
+      if (STRING_BYTES_BOUND < result_len)
+       string_overflow ();
     }
 
   if (! some_multibyte)